package com.quasar.hpatient.base;

import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.support.v4.app.Fragment;

import com.quasar.hpatient.R;
import com.quasar.hpatient.utils.LogAndToastUtil;

/**
 * author : 许建宏
 * Date: 2017/9/30 0030
 * View:
 */

public abstract class BaseFragment extends Fragment {

    public ProgressDialog pd;
    //初始化布局
    public abstract void initView();

    //初始化数据
    public abstract void initData();

    //弹出消息
    public void msg(String msg) {
        LogAndToastUtil.toast(getActivity(), msg, "");
    }


    public void showDialog() {
        pd = new ProgressDialog(getActivity());
        pd.setCanceledOnTouchOutside(false);
        pd.setOnCancelListener(new DialogInterface.OnCancelListener() {

            @Override
            public void onCancel(DialogInterface dialog) {
            }
        });
        pd.setMessage(getString(R.string.st_loading));
        pd.show();
    }

    public void dessDialog(){
        if(pd!=null){
            pd.dismiss();
        }
    }
}
